home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / TeXsource / beebe / h / setchar < prev    next >
Encoding:
Text File  |  1990-12-18  |  1.4 KB  |  55 lines

  1. /* -*-C-*- setchar.h */
  2. /*-->setchar*/
  3. /**********************************************************************/
  4. /****************************** setchar *******************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. #ifdef __STDC__
  9. setchar(register BYTE c, register BOOLEAN update_h)
  10. #else
  11. setchar(c, update_h)
  12. register BYTE c;
  13. register BOOLEAN update_h;
  14. #endif
  15. {
  16.     register struct char_entry *tcharptr;  /* temporary char_entry pointer */
  17.  
  18.     if (DBGOPT(DBG_SET_TEXT))
  19.     {
  20.     (void)fprintf(stderr,"setchar('");
  21.     if (isprint(c))
  22.         (void)putc(c,stderr);
  23.     else
  24.         (void)fprintf(stderr,"\\%03o",(int)c);
  25.     (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
  26.         (int)c, (long)hh, (long)vv, fontptr->n);
  27.     NEWLINE(stderr);
  28.     }
  29.  
  30.     tcharptr = &(fontptr->ch[c]);
  31.     if (((hh - tcharptr->xoffp + tcharptr->pxlw) <= XSIZE)
  32.     && (hh >= 0)
  33.     && (vv <= YSIZE)
  34.     && (vv >= 0))
  35.     {                /* character fits entirely on page */
  36.     moveto( hh, (COORDINATE)(YSIZE-vv));
  37.     dispchar(c);
  38.     }
  39.     else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
  40.     {                /* character is off page -- discard it */
  41.     (void)fprintf(stderr,
  42.         "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
  43.         isprint(c) ? c : '?',c,c,c);
  44.     NEWLINE(stderr);
  45.     }
  46.  
  47.     if (update_h)
  48.     {
  49.     h += (INT32)tcharptr->tfmw;
  50.     hh += (COORDINATE)tcharptr->pxlw;
  51.     hh = (COORDINATE)(fixpos(hh-lmargin,h,conv) + lmargin);
  52.     }
  53. }
  54.  
  55.